//导航栏
var top_daohang = document.getElementById('top_daohang');
var top_li = top_daohang.children;
for (i = 0; i < top_li.length - 1; i++) {
    top_li[i].onclick = function () {
        for (j = 0; j < top_li.length; j++) {
            top_li[j].className = ''
        }
        this.className = 'active';
    }
}





// 主页-右部导航

//主页- kv
var kv_show = document.querySelector('.kv_tanchuang');
var kv_bg = document.querySelector('.kv_bg');
function kv_show1() {
    kv_show.style.display = 'block';
    kv_bg.style.display = 'block'
}
function kv_close1() {
    kv_show.style.display = 'none';
    kv_bg.style.display = 'none';
}




// 主页——新闻
var news_active_1 = document.querySelector('.news_active_1');

var news_li = document.querySelectorAll('.news_left_top li');

var news_active_2 = document.querySelector('.news_active_2');

var news_none = document.querySelector('.news_left_text').children;
for (i = 0; i < news_li.length; i++) {
    news_li[i].setAttribute('index', i);
    news_li[i].onmouseover = function () {
        for (j = 0; j < news_li.length; j++) {
            news_li[j].className = '';
            if (j == 0) {
                news_none[j].className = 'news_none ';
            } else {
                news_none[j].className = 'news_none';
            }
        }
        this.className = ' news_active_1';
        var idx = this.getAttribute('index');
        if (idx == 0) {
            news_none[idx].className = 'news_none news_active_2 news_left_text_1';
        } else {
            news_none[idx].className = 'news_none news_active_2';
        }
    }
}


var news_right_li = document.querySelectorAll('.news_right li');
var news_right_span = document.querySelectorAll('.news_right span')
var news_right_math = 0;
function news_right_img() {

    if (news_right_math == 2) {
        news_right_math = 0;
    }
    if (news_right_math == 0) {
        news_right_li[0].style.display = 'block';
        news_right_li[1].style.display = '';
        news_right_span[0].className = 'news_active_3';
        news_right_span[1].className = '';
    }
    if (news_right_math == 1) {
        news_right_li[1].style.display = 'block';
        news_right_li[0].style.display = '';
        news_right_span[1].className = 'news_active_3';
        news_right_span[0].className = '';
    }
    news_right_math++;
}
news_right_span[0].onclick = function () {
    news_right_li[0].style.display = 'block';
    news_right_li[1].style.display = '';
    news_right_span[0].className = 'news_active_3';
    news_right_span[1].className = '';
};
news_right_span[1].onclick = function () {
    news_right_li[1].style.display = 'block';
    news_right_li[0].style.display = '';
    news_right_span[1].className = 'news_active_3';
    news_right_span[0].className = '';
};
news_right_img();
setInterval(news_right_img, 2000);







//原创魔导师目录——首页
let mdml_ul3_imgs = [["../others/ry_skill_1.webp", "../others/ry_skill_2.webp", "../others/ry_skill_3.webp", "../others/ry_skill_4.webp", "../others/ry_skill_5.webp", "../others/ry_skill_6.webp"],
["../others/ld_skill_1.webp", "../others/ld_skill_2.webp", "../others/ld_skill_3.webp", "../others/ld_skill_4.webp", "../others/ld_skill_5.webp", "../others/ld_skill_6.webp"],
["../others/hz_skill_1.webp", "../others/hz_skill_2.webp", "../others/hz_skill_3.webp", "../others/hz_skill_4.webp", "../others/hz_skill_5.webp", "../others/hz_skill_6.webp"],
["../others/sd_skill_1.webp", "../others/sd_skill_2.webp", "../others/sd_skill_3.webp", "../others/sd_skill_4.webp", "../others/sd_skill_5.webp", "../others/sd_skill_6.webp"],
["../others/zy_skill_1.webp", "../others/zy_skill_2.webp", "../others/zy_skill_3.webp", "../others/zy_skill_4.webp", "../others/zy_skill_5.webp", "../others/zy_skill_6.webp"],
["../others/ll_skill_1.webp", "../others/ll_skill_2.webp", "../others/ll_skill_3.webp", "../others/ll_skill_4.webp", "../others/ll_skill_5.webp", "../others/ll_skill_6.webp"],
["../others/wz_skill_1.webp", "../others/wz_skill_2.webp", "../others/wz_skill_3.webp", "../others/wz_skill_4.webp", "../others/wz_skill_5.webp", "../others/wz_skill_6.webp"],
["../others/sb_skill_1.webp", "../others/sb_skill_2.webp", "../others/sb_skill_3.webp", "../others/sb_skill_4.webp", "../others/sb_skill_5.webp", "../others/sb_skill_6.webp"],
["../others/yj_skill_1.webp", "../others/yj_skill_2.webp", "../others/yj_skill_3.webp", "../others/yj_skill_4.webp", "../others/yj_skill_5.webp", "../others/yj_skill_6.webp"],
["../others/xw_skill_1.webp", "../others/xw_skill_2.webp", "../others/xw_skill_3.webp", "../others/xw_skill_4.webp", "../others/xw_skill_5.webp", "../others/xw_skill_6.webp"],
["../others/sh_skill_1.webp", "../others/sh_skill_2.webp", "../others/sh_skill_3.webp", "../others/sh_skill_4.webp", "../others/sh_skill_5.webp", "../others/sh_skill_6.webp"]];

let mdml_ul1_li = document.querySelectorAll('.mdml_ul1 li');

let mdml_ul1_li_0_bgPosition = [-309 + "px " + -181 + "px",
-513 + "px " + -181 + "px",
-105 + "px " + -181 + "px",
-207 + "px " + -181 + "px",
-717 + "px " + -181 + "px",
-309 + "px " + -181 + "px",
-513 + "px " + -181 + "px",
-411 + "px " + -181 + "px",
-3 + "px " + -181 + "px",
-615 + "px " + -181 + "px",
-717 + "px " + -460 + "px"];

let mdml_ul1_li_0_bgPosition_active = [-441 + "px " + -296 + "px",
-735 + "px " + -296 + "px",
-147 + "px " + -296 + "px",
-294 + "px " + -296 + "px",
-147 + "px " + -460 + "px",
-441 + "px " + -296 + "px",
-735 + "px " + -296 + "px",
-588 + "px " + -296 + "px",
0 + "px " + -296 + "px",
0 + "px " + -460 + "px",
-147 + "px " + -460 + "px"];


let mdml_ul1_li_1_bgPosition = [-207 + 'px ' + -181 + 'px',
-105 + 'px ' + -181 + 'px',
-3 + 'px ' + -181 + 'px',
-717 + 'px ' + -181 + 'px',
-105 + 'px ' + -181 + 'px',
-207 + 'px ' + -181 + 'px',
-615 + 'px ' + -181 + 'px',
-309 + 'px ' + -181 + 'px',
-411 + 'px ' + -181 + 'px',
-513 + 'px ' + -181 + 'px',
-615 + 'px ' + -181 + 'px'];

let mdml_ul1_li_1_bgPosition_active = [-294 + 'px ' + -296 + 'px',
-147 + 'px ' + -296 + 'px',
-0 + 'px ' + -296 + 'px',
-147 + 'px ' + -460 + 'px',
-147 + 'px ' + -296 + 'px',
-294 + 'px ' + -296 + 'px',
-0 + 'px ' + -460 + 'px',
-441 + 'px ' + -296 + 'px',
-588 + 'px ' + -296 + 'px',
-735 + 'px ' + -296 + 'px',
0 + 'px ' + -460 + 'px'];


let mdml_ul4_li = document.querySelectorAll('.mdml_ul4 li');

let mdml_li1 = document.querySelector('.mdml_li1');
let mdml_li1_bgposition = [-320 + 'px ' + -88 + 'px',
-159 + 'px ' + -3 + 'px',
-702 + 'px ' + -3 + 'px',
-4 + 'px ' + -2 + 'px',
-476 + 'px ' + -2 + 'px',
-320 + 'px ' + -88 + 'px',
-159 + 'px ' + -3 + 'px',
-159 + 'px ' + -88 + 'px',
-1 + 'px ' + -88 + 'px',
-319 + 'px ' + -3 + 'px',
-476 + 'px ' + -2 + 'px'];

let mdml_li1_bgposition_onclick = [-4 + 'px ' + -2 + 'px',
-702 + 'px ' + -3 + 'px',
-1 + 'px ' + -88 + 'px',
-476 + 'px ' + -2 + 'px',
-702 + 'px ' + -3 + 'px',
-4 + 'px ' + -2 + 'px',
-319 + 'px ' + -3 + 'px',
-320 + 'px ' + -88 + 'px',
-159 + 'px ' + -88 + 'px',
-159 + 'px ' + -3 + 'px',
-319 + 'px ' + -3 + 'px'];

let mdml_span = document.querySelectorAll('.mdml span')

let mdml_c_img = document.querySelector('.mdml_c_img');

let mdml_c_imgs = ["../others/role-y.png", "../others/role-xn.png", "../others/role-jnl.png", "../others/role-xl.png", "../others/role-kls.png", "../others/role-y.png", "../others/role-xn.png", "../others/role-ty.png", "../others/role-dn.png", "../others/role-nk.png", "../others/role-kls.png"];
let mdml_c_imgs_onclick = ["../others/role-xl.png", "../others/role-jnl.png", "../others/role-dn.png", "../others/role-kls.png", "../others/role-jnl.png", "../others/role-xl.png", "../others/role-nk.png", "../others/role-y.png", "../others/role-ty.png", "../others/role-xn.png", "../others/role-nk.png"]

let mdml_ul3_img = document.querySelectorAll('.mdml_ul3 img')

let mdml_ul3_p = document.querySelectorAll('.mdml_ul3 p')

for (i = 0; i < mdml_ul4_li.length; i++) {

    mdml_ul4_li[i].setAttribute('index', i);

    mdml_ul4_li[i].onmouseover = function () {
        for (j = 0; j < 11; j++) {
            mdml_ul4_li[j].className = '';
        }
        this.className = 'on';

        var mdml_i = this.getAttribute('index');

        mdml_ul1_li[1].className = '';
        mdml_ul1_li[0].className = 'mdml_active1';

        mdml_c_img.src = mdml_c_imgs[mdml_i];

        mdml_span[0].innerHTML = jobmessage[mdml_i].mofaName;
        mdml_span[1].innerHTML = jobmessage[mdml_i].orientation;
        mdml_span[2].innerHTML = jobmessage[mdml_i].desc;

        mdml_ul1_li[0].style.backgroundPosition = mdml_ul1_li_0_bgPosition_active[mdml_i];


        mdml_ul1_li[1].style.backgroundPosition = mdml_ul1_li_1_bgPosition[mdml_i];


        mdml_li1.style.backgroundPosition = mdml_li1_bgposition[mdml_i];



        for (j = 0; j < 6; j++) {
            mdml_ul3_img[j].src = mdml_ul3_imgs[mdml_i][j];

            mdml_ul3_p[j].innerHTML = jobmessage[mdml_i].skill[j].skillName;
        }


        mdml_li1.style.width = 70 + 'px';
        if (mdml_i == 0) {
            mdml_span[3].innerHTML = mageMessage[3].bg;
        }
        if (mdml_i == 1) {
            mdml_span[3].innerHTML = mageMessage[5].bg;
            mdml_li1.style.width = 134 + 'px';
        }
        if (mdml_i == 2) {
            mdml_span[3].innerHTML = mageMessage[1].bg;
            mdml_li1.style.width = 201 + 'px';
        }
        if (mdml_i == 3) {
            mdml_span[3].innerHTML = mageMessage[2].bg;
            mdml_li1.style.width = 140 + 'px';
        }
        if (mdml_i == 4) {
            mdml_span[3].innerHTML = mageMessage[7].bg;
            mdml_li1.style.width = 201 + 'px';
        }
        if (mdml_i == 5) {
            mdml_span[3].innerHTML = mageMessage[3].bg;
        }
        if (mdml_i == 6) {
            mdml_span[3].innerHTML = mageMessage[5].bg;
            mdml_li1.style.width = 134 + 'px';
        }
        if (mdml_i == 7) {
            mdml_span[3].innerHTML = mageMessage[4].bg;
            mdml_li1.style.width = 134 + 'px';
        }
        if (mdml_i == 8) {
            mdml_span[3].innerHTML = mageMessage[0].bg;
            mdml_li1.style.width = 134 + 'px';
        }
        if (mdml_i == 9) {
            mdml_span[3].innerHTML = mageMessage[6].bg;
            mdml_li1.style.width = 134 + 'px';
        }
        if (mdml_i == 10) {
            mdml_span[3].innerHTML = mageMessage[7].bg;
            mdml_li1.style.width = 201 + 'px';
        }





        mdml_ul1_li[0].onclick = function () {
            mdml_ul1_li[1].className = '';
            mdml_ul1_li[0].className = 'mdml_active1';
            mdml_ul1_li[1].style.backgroundPosition = mdml_ul1_li_1_bgPosition[mdml_i];

            mdml_ul1_li[0].style.backgroundPosition = mdml_ul1_li_0_bgPosition_active[mdml_i];
            mdml_li1.style.backgroundPosition = mdml_li1_bgposition[mdml_i];
            mdml_c_img.src = mdml_c_imgs[mdml_i];

            if (mdml_i == 0) {
                mdml_span[3].innerHTML = mageMessage[3].bg;
                mdml_li1.style.width = 70 + 'px';
            }
            if (mdml_i == 1) {
                mdml_span[3].innerHTML = mageMessage[5].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 2) {
                mdml_span[3].innerHTML = mageMessage[1].bg;
                mdml_li1.style.width = 201 + 'px';
            }
            if (mdml_i == 3) {
                mdml_span[3].innerHTML = mageMessage[2].bg;
                mdml_li1.style.width = 140 + 'px';
            }
            if (mdml_i == 4) {
                mdml_span[3].innerHTML = mageMessage[7].bg;
                mdml_li1.style.width = 201 + 'px';
            }
            if (mdml_i == 5) {
                mdml_span[3].innerHTML = mageMessage[3].bg;
                mdml_li1.style.width = 70 + 'px';
            }
            if (mdml_i == 6) {
                mdml_span[3].innerHTML = mageMessage[5].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 7) {
                mdml_span[3].innerHTML = mageMessage[4].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 8) {
                mdml_span[3].innerHTML = mageMessage[0].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 9) {
                mdml_span[3].innerHTML = mageMessage[6].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 10) {
                mdml_span[3].innerHTML = mageMessage[7].bg;
                mdml_li1.style.width = 201 + 'px';
            }
        }




        mdml_ul1_li[1].onclick = function () {
            mdml_ul1_li[0].className = '';
            mdml_ul1_li[1].className = 'mdml_active2';

            mdml_ul1_li[1].style.backgroundPosition = mdml_ul1_li_1_bgPosition_active[mdml_i];

            mdml_ul1_li[0].style.backgroundPosition = mdml_ul1_li_0_bgPosition[mdml_i];

            mdml_li1.style.backgroundPosition = mdml_li1_bgposition_onclick[mdml_i];

            mdml_c_img.src = mdml_c_imgs_onclick[mdml_i];
            if (mdml_i == 0) {
                mdml_span[3].innerHTML = mageMessage[2].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 1) {
                mdml_span[3].innerHTML = mageMessage[1].bg;
                mdml_li1.style.width = 201 + 'px';
            }
            if (mdml_i == 2) {
                mdml_span[3].innerHTML = mageMessage[0].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 3) {
                mdml_span[3].innerHTML = mageMessage[7].bg;
                mdml_li1.style.width = 201 + 'px';
            }
            if (mdml_i == 4) {
                mdml_span[3].innerHTML = mageMessage[1].bg;
                mdml_li1.style.width = 201 + 'px';
            }
            if (mdml_i == 5) {
                mdml_span[3].innerHTML = mageMessage[2].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 6) {
                mdml_span[3].innerHTML = mageMessage[6].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 7) {
                mdml_span[3].innerHTML = mageMessage[3].bg;
                mdml_li1.style.width = 70 + 'px';
            }
            if (mdml_i == 8) {
                mdml_span[3].innerHTML = mageMessage[4].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 9) {
                mdml_span[3].innerHTML = mageMessage[5].bg;
                mdml_li1.style.width = 134 + 'px';
            }
            if (mdml_i == 10) {
                mdml_span[3].innerHTML = mageMessage[6].bg;
                mdml_li1.style.width = 134 + 'px';
            }
        }
    }
}

if (mdml_ul4_li[0].className == 'on') {
    mdml_ul1_li[0].onclick = function () {
        mdml_ul1_li[1].className = '';
        mdml_ul1_li[0].className = 'mdml_active1';

        mdml_ul1_li[1].style.backgroundPosition = mdml_ul1_li_1_bgPosition[0];

        mdml_ul1_li[0].style.backgroundPosition = mdml_ul1_li_0_bgPosition_active[0];

        mdml_span[3].innerHTML = mageMessage[3].bg;
        mdml_li1.style.width = 70 + 'px';
        mdml_li1.style.backgroundPosition = mdml_li1_bgposition[0];
        mdml_c_img.src = mdml_c_imgs[0];

    }

    mdml_ul1_li[1].onclick = function () {
        mdml_ul1_li[0].className = '';
        mdml_ul1_li[1].className = 'mdml_active2';

        mdml_ul1_li[1].style.backgroundPosition = mdml_ul1_li_1_bgPosition_active[0];

        mdml_ul1_li[0].style.backgroundPosition = mdml_ul1_li_0_bgPosition[0];

        mdml_span[3].innerHTML = mageMessage[2].bg;
        mdml_li1.style.width = 134 + 'px';
        mdml_li1.style.backgroundPosition = mdml_li1_bgposition_onclick[0]
        mdml_c_img.src = mdml_c_imgs_onclick[0];
    }
}





//最强小队助战——首页

let zqxd_li = document.querySelectorAll('.zqxd_center li');
let zqxd_img = document.querySelector('.zqxd_center1 img');
let zqxd_imgs = ["../others/zqxd_c_1.png", "../others/zqxd_c_2.png", "../others/zqxd_c_3.png", "../others/zqxd_c_4.png", "../others/zqxd_c_5.png", "../others/zqxd_c_6.png", "../others/zqxd_c_7.png", "../others/zqxd_c_8.png"];

let zqxd_p1 = document.querySelector('.zqxd_name');


let zqxd_p2 = document.querySelector('.zqxd_text1')


for (i = 0; i < zqxd_li.length; i++) {
    zqxd_li[i].setAttribute('index', i);
    zqxd_li[i].onclick = function () {
        for (j = 0; j < zqxd_li.length; j++) {
            zqxd_li[j].className = '';
        }
        this.className = 'zqxd_on';
        let zqxd_i = this.getAttribute('index');
        zqxd_img.src = zqxd_imgs[zqxd_i];
        zqxd_p1.innerHTML = dataArr[zqxd_i].roleName;
        zqxd_p2.innerHTML = dataArr[zqxd_i].roleinfo;
    }
}


//m冒险指南
let mxzn_li = document.querySelectorAll('.mxzn_center li');
for (i = 0; i < mxzn_li.length; i++) {
    mxzn_li[i].onclick = function () {
        for (j = 0; j < mxzn_li.length; j++) {
            mxzn_li[j].className = ''
        }
        this.className = 'mxzn_on';
        this.children[1].style.display = 'block';
    }
}






// 游戏特色
let yxts_dh = document.querySelector('.yxts_dh');
let yxts_span = document.querySelectorAll('.yxts_span span');
let yxts_i = 1;
let yxts_j=0;
function yxtsDh() {
        yxts_i++;
    if (yxts_i >=5 ) {
        yxts_i = 1;
    }
    let a = -990 * yxts_i;
    yxts_dh.style.transform = 'translate3d(' + a + 'px, 0px, 0px)';

}
function yxtsSpan_dh() {
    yxts_j++;
    if (yxts_j == 4) {
        yxts_j = 0;
    }
    for (h = 0; h < yxts_span.length; h++) {
        yxts_span[h].className = '';
    }
    yxts_span[yxts_j].className = 'news_active_3'
    
}

function yxts_a1() {
    yxts_i--;
    yxts_j--;
    if(yxts_i<=0){
        yxts_i=4;
    }
    if (yxts_j <= -1) {
        yxts_j = 3;
    }

    let b = -990 * yxts_i ;
    yxts_dh.style.transform = 'translate3d(' + b + 'px, 0px, 0px)';
    for (h = 0; h < yxts_span.length; h++) {
        yxts_span[h].className = '';
    }
    yxts_span[yxts_j].className = 'news_active_3';
}
function yxts_a2() {
    yxts_i++;
    yxts_j++;
    if (yxts_i >= 5){
        yxts_i = 1;
    }
    if (yxts_j >= 4) {
        yxts_j = 0;
    }

    let b = -990 * yxts_i ;
    yxts_dh.style.transform = 'translate3d(' + b + 'px, 0px, 0px)';
    for (h = 0; h < yxts_span.length; h++) {
        yxts_span[h].className = '';
    }
    yxts_span[yxts_j].className = 'news_active_3';
}
for (i = 0; i < yxts_span.length; i++) {
    yxts_span[i].setAttribute('index', i);
    yxts_span[i].onclick = function () {
        for (j = 0; j < yxts_span.length; j++) {
            yxts_span[j].className = '';
        }
        this.className = 'news_active_3';
        yxts_i = +this.getAttribute('index') +1;
        yxts_j=+this.getAttribute('index');
        yxts_dh.style.transform = 'translate3d(' + yxts_i * -990  + 'px, 0px, 0px)';


    }
}
setInterval(yxtsDh, 5000);
setInterval(yxtsSpan_dh, 5000);



//首页 侧边导航栏
var dhHeight=window.innerHeight;
var rightDh=document.querySelector('.right_dh');

var dh_sq=document.querySelector('.dh_sq');

var dh_li_a=document.querySelectorAll('.dh_ul a');


var dhA=dhHeight/988;
rightDh.style.zoom=dhA;
window.onresize=function(){
    var h=window.innerHeight;
    var dhB=h/988;
    rightDh.style.zoom=dhB;
}
var dh_flag=0;
function dh_sqA(){
    if(dh_flag){
        rightDh.style.right='0';
        dh_flag--;
    }else{
        rightDh.style.right='-223px';
        dh_flag++;
    }
}

for(i=0;i<dh_li_a.length;i++){
    dh_li_a[i].onmouseover=function(){
        for(j=0;j<dh_li_a.length;j++){
            dh_li_a[j].className=''
        }
        this.className='dh_on';
    }
    
}

